
<#-- 导入模版定义文件-->
<#include "../template/template_editPage.ftl">
<@edit title="角色操作">
	<#if (role.id)??>
		<#assign isEdit = true />
	<#else>
		<#assign isAdd = true />
	</#if>
	<body class="input">
	<script type="text/javascript">
	$().ready( function() {
	
		var $validateErrorContainer = $("#validateErrorContainer");
		var $validateErrorLabelContainer = $("#validateErrorContainer ul");
		var $validateForm = $("#validateForm");
		var $tab = $("#tab");
	
		// Tab效果
		$tab.tabs(".tabContent", {
			tabs: "input"
		});
		
		// 表单验证
		$validateForm.validate({
			errorContainer: $validateErrorContainer,
			errorLabelContainer: $validateErrorLabelContainer,
			wrapper: "li",
			errorClass: "validateError",
			ignoreTitle: true,
			rules: {
					"role.name": {
						required: true,
						username: true,
						minlength: 2,
						maxlength: 	 200
					},
				"role.remark": {
					required: true
				}
			},
			messages: {
					"role.name": {
						required: "请填写名称",
						minlength: "用户名必须大于等于2",
						maxlength: 	 "角色名必须小于等于200"
					},
				"role.remark": {
						required: "请填写备注信息"
				}			
			},
			submitHandler: function(form) {
				$(form).find(":submit").attr("disabled", true);
				form.submit();
			}
		});
		<#if actionErrors??&&(actionErrors?size > 0)>
			$.dialog({type: "warn", content: "<#list errorMessages as list>${list}<br></#list>",
			 modal: true, autoCloseTime: 3000});
		</#if>
	});
	</script>
		<div class="body">
			<div class="inputBar">
				<h1><span class="icon">&nbsp;</span><#if isAdd??>添加角色<#else>编辑角色</#if></h1>
			</div>
			<div style="display: none;" id="validateErrorContainer" class="validateErrorContainer">
				<div class="validateErrorTitle">以下信息填写有误,请重新填写</div>
				<ul></ul>
			</div>			
			<form id="validateForm" class="validate" method="post" action="<#if isAdd??>${web_base}/system/role!addRole.htm<#else>${web_base}/system/role!editRole.htm</#if>">
			<table class="inputTable tabContent">
			<tr>
				<th>角色名称:<input type="hidden" name="role.id" value="<#if isEdit??>${(role.id)!}</#if>" ></th>
				<td><input type="text" class="formText" name="role.name" value="${(role.name)!}" ><label class="requireField">*</label></td>
			</tr>
			<tr>
				<th>备注:</th>
				<td><input type="text" class="formText" name="role.remark" value="${(role.remark)!}" ><label class="requireField">*</label></td>
			</tr>
			</table>
			<div class="buttonArea">
				<input type="submit" class="formButton" value="<#if isAdd??>添加<#else>修改</#if>" hidefocus="true" />&nbsp;&nbsp;&nbsp;&nbsp;
				<input type="button" class="formButton" onclick="window.history.back(); return false;" value="返  回" hidefocus="true" />
			</div>
			</form>
		</div>
	</body>

</@edit>